ALTER TABLE [dbo].[sys_file] ADD [model_name] varchar(255)



DROP TABLE [dbo].[sys_menu]



CREATE TABLE [dbo].[sys_menu] (
  [id] bigint  IDENTITY(1,1) NOT NULL,
  [parent_id] bigint  NULL,
  [name] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [url] varchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [perms] varchar(500) COLLATE Chinese_PRC_CI_AS  NULL,
  [type] int  NULL,
  [icon] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [order_num] int  NULL,
  CONSTRAINT [PK__sys_menu__4CA0FADC7BB05806] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
)
ON [PRIMARY]
GO

ALTER TABLE [dbo].[sys_menu] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'父菜单ID，一级菜单为0',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'parent_id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'菜单名称',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'name'
GO

EXEC sp_addextendedproperty
'MS_Description', N'菜单URL',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'url'
GO

EXEC sp_addextendedproperty
'MS_Description', N'授权(多个用逗号分隔，如：user:list,user:create)',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'perms'
GO

EXEC sp_addextendedproperty
'MS_Description', N'类型   0：目录   1：菜单   2：按钮',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'type'
GO

EXEC sp_addextendedproperty
'MS_Description', N'菜单图标',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'icon'
GO

EXEC sp_addextendedproperty
'MS_Description', N'排序',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'order_num'




DROP TABLE [dbo].[sys_role]


CREATE TABLE [dbo].[sys_role] (
  [id] bigint  IDENTITY(1,1) NOT NULL,
  [role_name] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [remark] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [create_time] datetime  NULL,
  CONSTRAINT [PK__sys_role__760965CC0169315C] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
)
ON [PRIMARY]
GO

ALTER TABLE [dbo].[sys_role] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'角色名称',
'SCHEMA', N'dbo',
'TABLE', N'sys_role',
'COLUMN', N'role_name'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注',
'SCHEMA', N'dbo',
'TABLE', N'sys_role',
'COLUMN', N'remark'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_role',
'COLUMN', N'create_time'



DROP TABLE [dbo].[sys_role_menu]


CREATE TABLE [dbo].[sys_role_menu] (
  [id] bigint  IDENTITY(1,1) NOT NULL,
  [role_id] bigint  NULL,
  [menu_id] bigint  NULL,
  CONSTRAINT [PK__sys_role__3213E83F07220AB2] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
)
ON [PRIMARY]
GO

ALTER TABLE [dbo].[sys_role_menu] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'角色ID',
'SCHEMA', N'dbo',
'TABLE', N'sys_role_menu',
'COLUMN', N'role_id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'菜单ID',
'SCHEMA', N'dbo',
'TABLE', N'sys_role_menu',
'COLUMN', N'menu_id'



DROP TABLE [dbo].[sys_user_role]


CREATE TABLE [dbo].[sys_user_role] (
  [id] bigint  IDENTITY(1,1) NOT NULL,
  [user_id] bigint  NULL,
  [role_id] bigint  NULL,
  CONSTRAINT [PK__sys_user__3213E83F0FB750B3] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
)
ON [PRIMARY]
GO

ALTER TABLE [dbo].[sys_user_role] SET (LOCK_ESCALATION = TABLE)





       CREATE TABLE [dbo].[sys_dict] (
  [id] bigint  IDENTITY(1,1) NOT NULL,
  [name] varchar(100) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [type] varchar(100) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [code] int  NOT NULL,
  [value] varchar(1000) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [order_num] int  NULL,
  [remark] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [del_flag] tinyint  NULL,
  CONSTRAINT [PK__sys_dict__3213E83F75F77EB0] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
)
ON [PRIMARY]
GO

ALTER TABLE [dbo].[sys_dict] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'字典名称',
'SCHEMA', N'dbo',
'TABLE', N'sys_dict',
'COLUMN', N'name'
GO

EXEC sp_addextendedproperty
'MS_Description', N'字典类型',
'SCHEMA', N'dbo',
'TABLE', N'sys_dict',
'COLUMN', N'type'
GO

EXEC sp_addextendedproperty
'MS_Description', N'字典码',
'SCHEMA', N'dbo',
'TABLE', N'sys_dict',
'COLUMN', N'code'
GO

EXEC sp_addextendedproperty
'MS_Description', N'字典值',
'SCHEMA', N'dbo',
'TABLE', N'sys_dict',
'COLUMN', N'value'
GO

EXEC sp_addextendedproperty
'MS_Description', N'排序',
'SCHEMA', N'dbo',
'TABLE', N'sys_dict',
'COLUMN', N'order_num'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注',
'SCHEMA', N'dbo',
'TABLE', N'sys_dict',
'COLUMN', N'remark'
GO

EXEC sp_addextendedproperty
'MS_Description', N'删除标记  -1：已删除  0：正常',
'SCHEMA', N'dbo',
'TABLE', N'sys_dict',
'COLUMN', N'del_flag'





CREATE TABLE [dbo].[sys_log] (
  [id] bigint  IDENTITY(1,1) NOT NULL,
  [user_id] bigint  NULL,
  [user_name] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [operation_code] int  NULL,
  [operation_name] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [method] varchar(500) COLLATE Chinese_PRC_CI_AS  NULL,
  [params] varchar(5000) COLLATE Chinese_PRC_CI_AS  NULL,
  [cost_time] bigint  NULL,
  [source_ip] varchar(500) COLLATE Chinese_PRC_CI_AS  NULL,
  [date_create] datetime  NULL,
  CONSTRAINT [sys_log_pk] PRIMARY KEY NONCLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
)
ON [PRIMARY]
GO

ALTER TABLE [dbo].[sys_log] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'执行时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_log',
'COLUMN', N'cost_time'
GO

EXEC sp_addextendedproperty
'MS_Description', N'访问源头ip',
'SCHEMA', N'dbo',
'TABLE', N'sys_log',
'COLUMN', N'source_ip'
GO

EXEC sp_addextendedproperty
'MS_Description', N'系统操作日志',
'SCHEMA', N'dbo',
'TABLE', N'sys_log'